package smashedapples.air.sqlite
{
	import smashedapples.core.NonVisualComponent;

	
	[DefaultProperty("columns")]
	public class SQLiteTable extends NonVisualComponent
	{
		public function SQLiteTable()
		{
			super();
		}
		
		
		[ArrayElementType("smashedapples.air.sqlite.SQLiteColumn")]
		public var columns:Array = [];
		
		public var name:String;
		
		
		public function get primaryKey():SQLiteColumn
		{
			var pk:SQLiteColumn;
			for each( var column:SQLiteColumn in this.columns )
			{
				if( column.isPrimaryKey )
				{
					pk = column;	
					break;  
				}
			}
			
			return pk;
		}
		
		
	}
}